<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script>
  //单词组成，长度6-12
  var reg1 = /^\w{6,12}$/;
  let flag1 = reg1.test("zhangsan_1");  //true
  let flag2 = reg1.test("ab123123*");  //false
  let flag3 = reg1.test("abc");  //false
  //数字组成，长度11位，第一位数字是1
  var reg2 = /^[1]\d{10}$/;
  let flag4 = reg2.test("13611112222"); //true
  let flag5 = reg2.test("03611112222"); //false
  let flag6 = reg2.test("136"); //false
  alert(flag1);
  alert(flag2);
  alert(flag3);
  alert(flag4);
  alert(flag5);
  alert(flag6);
</script>
</body>
</html>